<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>HTML和CSS面试题 | 破破的QQ空间</title><meta name="author" content="破破"><meta name="copyright" content="破破"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="怎么让一个不定宽高的 DIV，垂直水平居中？1234567891011121314151617181920212223242526272829303132333435363738394041424344454647&#x2F;** flex 方法*&#x2F;display: flex;align-items: center;justify-cotent: center;&#x2F;** 知道盒子宽高 margin负值配合定位">
<meta property="og:type" content="article">
<meta property="og:title" content="HTML和CSS面试题">
<meta property="og:url" content="https://leiboy.gitee.io/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/index.html">
<meta property="og:site_name" content="破破的QQ空间">
<meta property="og:description" content="怎么让一个不定宽高的 DIV，垂直水平居中？1234567891011121314151617181920212223242526272829303132333435363738394041424344454647&#x2F;** flex 方法*&#x2F;display: flex;align-items: center;justify-cotent: center;&#x2F;** 知道盒子宽高 margin负值配合定位">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://leiboy.gitee.io/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/csslogo.png">
<meta property="article:published_time" content="2022-07-10T14:22:28.000Z">
<meta property="article:modified_time" content="2024-07-01T14:13:29.117Z">
<meta property="article:author" content="破破">
<meta property="article:tag" content="HTML">
<meta property="article:tag" content="CSS">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://leiboy.gitee.io/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/csslogo.png"><link rel="shortcut icon" href="/blog/img/favicon.png"><link rel="canonical" href="https://leiboy.gitee.io/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/blog/css/index.css?v=4.14.0-b3"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.1/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0.35/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>(()=>{
      const saveToLocal = {
        set: (key, value, ttl) => {
          if (ttl === 0) return
          const now = Date.now()
          const expiry = now + ttl * 86400000
          const item = {
            value,
            expiry
          }
          localStorage.setItem(key, JSON.stringify(item))
        },
      
        get: key => {
          const itemStr = localStorage.getItem(key)
      
          if (!itemStr) {
            return undefined
          }
          const item = JSON.parse(itemStr)
          const now = Date.now()
      
          if (now > item.expiry) {
            localStorage.removeItem(key)
            return undefined
          }
          return item.value
        }
      }
      
      window.btf = {
        saveToLocal: saveToLocal,
        getScript: (url, attr = {}) => new Promise((resolve, reject) => {
          const script = document.createElement('script')
          script.src = url
          script.async = true
          script.onerror = reject
          script.onload = script.onreadystatechange = function() {
            const loadState = this.readyState
            if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
            script.onload = script.onreadystatechange = null
            resolve()
          }

          Object.keys(attr).forEach(key => {
            script.setAttribute(key, attr[key])
          })

          document.head.appendChild(script)
        }),

        getCSS: (url, id = false) => new Promise((resolve, reject) => {
          const link = document.createElement('link')
          link.rel = 'stylesheet'
          link.href = url
          if (id) link.id = id
          link.onerror = reject
          link.onload = link.onreadystatechange = function() {
            const loadState = this.readyState
            if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
            link.onload = link.onreadystatechange = null
            resolve()
          }
          document.head.appendChild(link)
        }),

        addGlobalFn: (key, fn, name = false, parent = window) => {
          const pjaxEnable = false
          if (!pjaxEnable && key.startsWith('pjax')) return

          const globalFn = parent.globalFn || {}
          const keyObj = globalFn[key] || {}
    
          if (name && keyObj[name]) return
    
          name = name || Object.keys(keyObj).length
          keyObj[name] = fn
          globalFn[key] = keyObj
          parent.globalFn = globalFn
        }
      }
    
      const activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      const activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }

      btf.activateDarkMode = activateDarkMode
      btf.activateLightMode = activateLightMode
      
      const t = saveToLocal.get('theme')
    
        if (t === 'dark') activateDarkMode()
        else if (t === 'light') activateLightMode()
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
      const detectApple = () => {
        if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
          document.documentElement.classList.add('apple')
        }
      }
      detectApple()
    })()</script><script>const GLOBAL_CONFIG = {
  root: '/blog/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false,"highlightFullpage":true,"highlightMacStyle":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid@4.11.1/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'HTML和CSS面试题',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2024-07-01 22:13:29'
}</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">10</div></a><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">7</div></a><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div><hr class="custom-hr"/></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/csslogo.png')"><nav id="nav"><span id="blog-info"><a href="/blog/" title="破破的QQ空间"><span class="site-name">破破的QQ空间</span></a></span><div id="menus"><div id="toggle-menu"><span class="site-page"><i class="fas fa-bars fa-fw"></i></span></div></div></nav><div id="post-info"><h1 class="post-title">HTML和CSS面试题</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-07-10T14:22:28.000Z" title="发表于 2022-07-10 22:22:28">2022-07-10</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-07-01T14:13:29.117Z" title="更新于 2024-07-01 22:13:29">2024-07-01</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/%E9%9D%A2%E8%AF%95%E9%A2%98/">面试题</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="HTML和CSS面试题"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h4 id="怎么让一个不定宽高的-DIV，垂直水平居中？"><a href="#怎么让一个不定宽高的-DIV，垂直水平居中？" class="headerlink" title="怎么让一个不定宽高的 DIV，垂直水平居中？"></a>怎么让一个不定宽高的 DIV，垂直水平居中？</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">* flex 方法</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="attribute">display</span>: flex;</span><br><span class="line"><span class="attribute">align-items</span>: center;</span><br><span class="line">justify-cotent: center;</span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">* 知道盒子宽高 margin负值配合定位</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="selector-class">.son1</span> &#123;</span><br><span class="line">	<span class="attribute">width</span>: <span class="number">200px</span>;</span><br><span class="line">	<span class="attribute">height</span>: <span class="number">200px</span>;</span><br><span class="line">	<span class="attribute">position</span>: absolute;</span><br><span class="line">	<span class="attribute">top</span>: <span class="number">50%</span>;</span><br><span class="line">	<span class="attribute">left</span>: <span class="number">50%</span>;</span><br><span class="line">	<span class="attribute">margin-top</span>: -<span class="number">100px</span>;</span><br><span class="line">	<span class="attribute">margin-left</span>: -<span class="number">100px</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.son2</span> &#123;</span><br><span class="line">	<span class="attribute">width</span>: <span class="number">200px</span>;</span><br><span class="line">	<span class="attribute">height</span>: <span class="number">200px</span>;</span><br><span class="line">	<span class="attribute">position</span>: absolute;</span><br><span class="line">	<span class="attribute">top</span>: <span class="number">0</span>;</span><br><span class="line">	<span class="attribute">left</span>: <span class="number">0</span>;</span><br><span class="line">	<span class="attribute">right</span>: <span class="number">0</span>;</span><br><span class="line">	<span class="attribute">bottom</span>: <span class="number">0</span>;</span><br><span class="line">	<span class="attribute">margin</span>: auto;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">* CSS3 transform</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="attribute">position</span>: absolute;</span><br><span class="line"><span class="attribute">top</span>: <span class="number">50%</span>;</span><br><span class="line"><span class="attribute">left</span>: <span class="number">50%</span>;</span><br><span class="line"><span class="attribute">transform</span>: <span class="built_in">translate</span>(-<span class="number">50%</span>, -<span class="number">50%</span>);</span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">*使用display:table-cell方法</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="selector-class">.parent</span> &#123;</span><br><span class="line">	<span class="attribute">display</span>: table-cell;</span><br><span class="line">	<span class="attribute">text-align</span>: center;</span><br><span class="line">	<span class="attribute">vertical-align</span>: middle;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.son</span> &#123;</span><br><span class="line">	<span class="attribute">display</span>: inline-block;</span><br><span class="line">	<span class="attribute">vertical-align</span>: middle;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="position-几个属性的作用？"><a href="#position-几个属性的作用？" class="headerlink" title="position 几个属性的作用？"></a>position 几个属性的作用？</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">static -- 默认值 没有定位</span><br><span class="line">fixed  -- 绝对定位 相对于浏览器窗口</span><br><span class="line">absolute -- 绝对定位 相对于 static 定位以外的第一个父元素进行定位。</span><br><span class="line">relative -- 相对定位 相对于其正常位置进行定位。</span><br><span class="line">inherit -- 规定应该从父元素继承 <span class="attribute">position</span> 属性的值。</span><br></pre></td></tr></table></figure>

<h4 id="px，em，rem-的区别？"><a href="#px，em，rem-的区别？" class="headerlink" title="px，em，rem 的区别？"></a>px，em，rem 的区别？</h4><ul>
<li><p>px 像素（Pixel）。相对长度单位。像素 px 是相对于显示器屏幕分辨率而言的。</p>
<ol>
<li>IE 无法调整那些使用 px 作为单位的字体大小；</li>
<li>国外的大部分网站能够调整的原因在于其使用了 em 或 rem 作为字体单位；</li>
<li>Firefox 能够调整 px 和 em，rem，但是 96%以上的中国网民使用 IE 浏览器(或内核)。</li>
</ol>
</li>
<li><p>em 是相对长度单位。相对于当前对象内文本的字体尺寸。如当前对行内文本的字体尺寸未被人为设置，则相对于浏览器的默认字体尺寸。</p>
<ol>
<li>em 的值并不是固定的；</li>
<li>em 会继承父级元素的字体大小。</li>
</ol>
</li>
<li><p>rem 是 CSS3 新增的一个相对单位（root em，根 em），使用 rem 为元素设定字体大小时，仍然是相对大小，但相对的只是 HTML 根元素。</p>
<blockquote>
<p>rem 一般可以经过动态设置根元素大小来实现适配各种分辨率屏幕</p>
</blockquote>
</li>
</ul>
<h4 id="什么是-BFC？"><a href="#什么是-BFC？" class="headerlink" title="什么是 BFC？"></a>什么是 BFC？</h4><blockquote>
<p>BFC(Block formatting context)直译为”块级格式化上下文”。它是一个独立的渲染区域，只有 Block-level box 参与， 它规定了内部的 Block-level Box 如何布局，并且与这个区域外部毫不相干。</p>
<p>BFC 就是页面上的一个隔离的独立容器，容器里面的子元素不会影响到外面的元素。反之也如此。</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/sinat_36422236/article/details/88763187">更详细解释</a></p>
</blockquote>
<h4 id="CSS-引入的方式有哪些-link-和-import-的区别是"><a href="#CSS-引入的方式有哪些-link-和-import-的区别是" class="headerlink" title="CSS 引入的方式有哪些? link 和@import 的区别是?"></a>CSS 引入的方式有哪些? link 和@import 的区别是?</h4><ul>
<li>link 是 XHTML 标签，除了加载 CSS 外，还可以定义 RSS 等其他事务；@import 属于 CSS 范畴，只能加载 CSS。</li>
<li>link 引用 CSS 时，在页面载入时同时加载；@import 需要页面网页完全载入以后加载。</li>
<li>link 是 XHTML 标签，无兼容问题；@import 是在 CSS2.1 提出的，低版本的浏览器不支持。</li>
<li>ink 支持使用 Javascript 控制 DOM 去改变样式；而@import 不支持。</li>
</ul>
<h4 id="描述-css-reset-的作用和用途？"><a href="#描述-css-reset-的作用和用途？" class="headerlink" title="描述 css reset 的作用和用途？"></a>描述 css reset 的作用和用途？</h4><blockquote>
<p>HTML 标签在浏览器中都有默认的样式，不同的浏览器的默认样式之间存在差别。例如 ul 默认带有缩进样式，在 IE 下，它的缩进是由 margin 实现的，而在 Firefox 下却是由 padding 实现的。开发时浏览器的默认样式可能会给我们带来多浏览器兼容性问题，影响开发效率。所以解决的方法就是一开始就将浏览器的默认样式全部去掉，更准确说就是通过重新定义标签样式。“覆盖”浏览器的 CSS 默认属性。最最简单的说法就是把浏览器提供的默认样式覆盖掉！这就是 CSS reset。</p>
<p><a target="_blank" rel="noopener" href="http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css">css-reset 文件地址</a></p>
</blockquote>
<h4 id="解释-css-sprites，如何使用？"><a href="#解释-css-sprites，如何使用？" class="headerlink" title="解释 css sprites，如何使用？"></a>解释 css sprites，如何使用？</h4><blockquote>
<p>精灵图：简单来说就是把一些图标汇集到一张 png 上 通过像素点来显示不同位置的图片</p>
</blockquote>
<h4 id="清除浮动的几种方式？"><a href="#清除浮动的几种方式？" class="headerlink" title="清除浮动的几种方式？"></a>清除浮动的几种方式？</h4><ol>
<li><p><strong>额外标签法</strong>：给谁清除浮动，就在其后额外添加一个空白标签 。</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.clear</span> &#123;</span><br><span class="line">	<span class="attribute">clear</span>: both;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>父级添加 overflow 方法</strong>: 可以通过触发 BFC 的方式，实现清楚浮动效果。</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.parent</span> &#123;</span><br><span class="line">	<span class="attribute">overflow</span>: hidden;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>使用 after 伪元素清除浮动</strong>: <code> :after</code>方式为空元素的升级版，好处是不用单独加标签了。（较常用）</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.clearfix</span><span class="selector-pseudo">:after</span> &#123;</span><br><span class="line">	<span class="attribute">content</span>: <span class="string">&quot;&quot;</span>;</span><br><span class="line">	<span class="attribute">display</span>: block;</span><br><span class="line">	<span class="attribute">height</span>: <span class="number">0</span>;</span><br><span class="line">	<span class="attribute">clear</span>: both;</span><br><span class="line">	<span class="attribute">visibility</span>: hidden;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.clearfix</span> &#123;</span><br><span class="line">	*zoom: <span class="number">1</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>使用 before 和 after 双伪元素清除浮动</strong>: （较常用）</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.clearfix</span><span class="selector-pseudo">:before</span>,</span><br><span class="line"><span class="selector-class">.clearfix</span><span class="selector-pseudo">:after</span> &#123;</span><br><span class="line">	<span class="attribute">content</span>: <span class="string">&quot;&quot;</span>;</span><br><span class="line">	<span class="attribute">display</span>: table;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.clearfix</span><span class="selector-pseudo">:after</span> &#123;</span><br><span class="line">	<span class="attribute">clear</span>: both;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.clearfix</span> &#123;</span><br><span class="line">	*zoom: <span class="number">1</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></li>
</ol>
<h4 id="能否简述一下如何使一套设计方案，适应不同的分辨率，有哪些方法可以实现？"><a href="#能否简述一下如何使一套设计方案，适应不同的分辨率，有哪些方法可以实现？" class="headerlink" title="能否简述一下如何使一套设计方案，适应不同的分辨率，有哪些方法可以实现？"></a>能否简述一下如何使一套设计方案，适应不同的分辨率，有哪些方法可以实现？</h4><ul>
<li>百分比布局</li>
<li>flex 弹性盒子</li>
<li>rem 适配</li>
<li>各种框架的布局系统 如：bootstrap 的栅格系统</li>
<li>css 媒体查询实现不同相应分辨率显示相应效果</li>
<li>……</li>
</ul>
<h4 id="你能描述一下渐进增强和优雅降级之间的不同吗？"><a href="#你能描述一下渐进增强和优雅降级之间的不同吗？" class="headerlink" title="你能描述一下渐进增强和优雅降级之间的不同吗？"></a>你能描述一下渐进增强和优雅降级之间的不同吗？</h4><blockquote>
<p><strong>渐进增强（Progressive Enhancement）</strong>：一开始就针对低版本浏览器进行构建页面，完成基本的功能，然后再针对高级浏览器进行效果、交互、追加功能达到更好的体验。</p>
<p><strong>优雅降级（Graceful Degradation）</strong>：一开始就构建站点的完整功能，然后针对浏览器测试和修复。比如一开始使用 CSS3 的特性构建了一个应用，然后逐步针对各大浏览器进行 hack 使其可以在低版本浏览器上正常浏览。</p>
</blockquote>
<h4 id="合理的页面布局中常听过结构与表现分离，那么结构是什么？表现是什么？"><a href="#合理的页面布局中常听过结构与表现分离，那么结构是什么？表现是什么？" class="headerlink" title="合理的页面布局中常听过结构与表现分离，那么结构是什么？表现是什么？"></a>合理的页面布局中常听过结构与表现分离，那么结构是什么？表现是什么？</h4><blockquote>
<p>结构：HTML ( 骨架 )</p>
<p>表现：CSS</p>
</blockquote>
<h4 id="简述对-Web-语义化的理解？"><a href="#简述对-Web-语义化的理解？" class="headerlink" title="简述对 Web 语义化的理解？"></a>简述对 Web 语义化的理解？</h4><ul>
<li>正确的标签做正确的事情</li>
<li>页面内容结构化</li>
<li>无 CSS 样子时也容易阅读，便于阅读维护和理解</li>
<li>便于浏览器、搜索引擎解析。 利于爬虫标记、利于 SEO</li>
</ul>
<h4 id="CSS-都有哪些选择器？CSS-选择器的优先级是怎么样定义的？"><a href="#CSS-都有哪些选择器？CSS-选择器的优先级是怎么样定义的？" class="headerlink" title="CSS 都有哪些选择器？CSS 选择器的优先级是怎么样定义的？"></a>CSS 都有哪些选择器？CSS 选择器的优先级是怎么样定义的？</h4><ul>
<li><p><strong>选择器</strong></p>
<ol>
<li>标签名选择器</li>
<li>类选择器（class）</li>
<li>id 选择器 （#box）</li>
<li>后代选择器（空格隔开）</li>
<li>群组选择器（逗号隔开）</li>
</ol>
</li>
<li><p><strong>优先级</strong></p>
<p>​ 行内 &gt; id &gt; 类 &gt; 标签</p>
</li>
</ul>
<h4 id="display：-none；与-visibility：-hidden-的区别是什么？"><a href="#display：-none；与-visibility：-hidden-的区别是什么？" class="headerlink" title="display： none；与 visibility： hidden 的区别是什么？"></a>display： none；与 visibility： hidden 的区别是什么？</h4><ul>
<li>如果给一个元素设置了 display: none，那么该元素以及它的所有后代元素都会隐藏，它是前端开发人员使用频率最高的一种隐藏方式。隐藏后的元素无法点击，无法使用屏幕阅读器等辅助设备访问，占据的空间消失。</li>
<li>给元素设置 visibility: hidden 也可以隐藏这个元素，但是隐藏元素仍需占用与未隐藏时一样的空间，也就是说虽然元素不可见了，但是仍然会影响页面布局</li>
</ul>
<h4 id="用-CSS-定义-p-标签，要求实现以下效果：字体颜色在-IE6-下为黑色-000000-；IE7-下为红色-ff0000-；而其他浏览器下为绿色-00ff00"><a href="#用-CSS-定义-p-标签，要求实现以下效果：字体颜色在-IE6-下为黑色-000000-；IE7-下为红色-ff0000-；而其他浏览器下为绿色-00ff00" class="headerlink" title="用 CSS 定义 p 标签，要求实现以下效果：字体颜色在 IE6 下为黑色(#000000)；IE7 下为红色(#ff0000)；而其他浏览器下为绿色(#00ff00)"></a>用 CSS 定义 p 标签，要求实现以下效果：字体颜色在 IE6 下为黑色(#000000)；IE7 下为红色(#ff0000)；而其他浏览器下为绿色(#00ff00)</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">p</span> &#123;</span><br><span class="line">	<span class="attribute">color</span>: green;</span><br><span class="line">	*<span class="attribute">color</span>: blue;</span><br><span class="line">	_color: black;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="HTML-与-XHTML——二者有什么区别"><a href="#HTML-与-XHTML——二者有什么区别" class="headerlink" title="HTML 与 XHTML——二者有什么区别"></a>HTML 与 XHTML——二者有什么区别</h4><ul>
<li><p>XHTML 元素必须被正确地嵌套。</p>
</li>
<li><p>XHTML 元素必须被关闭。</p>
</li>
<li><p>标签名必须用小写字母。</p>
</li>
<li><p>所有的 XHTML 元素必须被嵌套于 <html> 根元素中。</p>
</li>
</ul>
<h4 id="Doctype-作用-严格模式与混杂模式-如何触发这两种模式，区分它们有何意义"><a href="#Doctype-作用-严格模式与混杂模式-如何触发这两种模式，区分它们有何意义" class="headerlink" title="Doctype 作用? 严格模式与混杂模式-如何触发这两种模式，区分它们有何意义?"></a>Doctype 作用? 严格模式与混杂模式-如何触发这两种模式，区分它们有何意义?</h4><blockquote>
<ul>
<li><p><strong>Doctype</strong>: <code>&lt;!DOCTYPE&gt;</code>声明叫做文件类型定义（DTD），声明的作用为了告诉浏览器该文件的类型。让浏览器解析器知道应该用哪个规范来解析文档。&lt;!DOCTYPE&gt;声明必须在 HTML 文档的第一行，这并不是一个 HTML 标签</p>
</li>
<li><p><strong>严格模式</strong>:又称标准模式，是指浏览器按照 W3C 标准解析代码。</p>
<p><strong>混杂模式</strong>:又称怪异模式或兼容模式，是指浏览器用自己的方式解析代码。</p>
<p><strong>如何区分</strong>:浏览器解析时到底使用严格模式还是混杂模式，与网页中的 DTD 直接相关。</p>
</li>
</ul>
</blockquote>
<h4 id="盒模型："><a href="#盒模型：" class="headerlink" title="盒模型："></a>盒模型：</h4><blockquote>
<p>W3C 标准中，如果设置一个元素的宽度和高度，指的是元素内容的宽度和高度，而在 Quirks 模式下，IE 的宽度和高度还包含了 padding 和 border。</p>
</blockquote>
<h4 id="Css-Hack？ie6-7-8-的-hack-分别是什么？"><a href="#Css-Hack？ie6-7-8-的-hack-分别是什么？" class="headerlink" title="Css Hack？ie6,7,8 的 hack 分别是什么？"></a>Css Hack？ie6,7,8 的 hack 分别是什么？</h4><blockquote>
<p>针对不同的浏览器写不同的 CSS code 的过程，就是 CSS hack。</p>
</blockquote>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"> <span class="attribute">background-color</span>:blue;      <span class="comment">/*firefox*/</span></span><br><span class="line"></span><br><span class="line"><span class="attribute">background-color</span>:red\<span class="number">9</span>;      <span class="comment">/*all ie*/</span></span><br><span class="line"></span><br><span class="line"><span class="attribute">background-color</span>:yellow;    <span class="comment">/*ie8*/</span></span><br><span class="line"></span><br><span class="line">+<span class="attribute">background-color</span>:pink;        <span class="comment">/*ie7*/</span></span><br><span class="line"></span><br><span class="line">_background-<span class="attribute">color</span>:orange;       <span class="comment">/*ie6*/</span>    &#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">:root</span> <span class="selector-id">#test</span> &#123; <span class="attribute">background-color</span>:purple\<span class="number">9</span>; &#125;  <span class="comment">/*ie9*/</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">@media</span> all <span class="keyword">and</span> (<span class="attribute">min-width</span>:<span class="number">0px</span>)&#123; <span class="selector-id">#test</span> &#123;<span class="attribute">background-color</span>:black;&#125; &#125;  <span class="comment">/*opera*/</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">@media</span> screen <span class="keyword">and</span> (<span class="attribute">-webkit-min-device-pixel-ratio</span>:<span class="number">0</span>)&#123; <span class="selector-id">#test</span> &#123;<span class="attribute">background-color</span>:gray;&#125; &#125;       <span class="comment">/*chrome and safari*/</span></span><br></pre></td></tr></table></figure>

<h4 id="请用-div-css-写出左侧固定-width-200px-右侧自适应页面宽度"><a href="#请用-div-css-写出左侧固定-width-200px-右侧自适应页面宽度" class="headerlink" title="请用 div+css 写出左侧固定(width:200px;),右侧自适应页面宽度."></a>请用 div+css 写出左侧固定(width:200px;),右侧自适应页面宽度.</h4><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">style</span>&gt;</span><span class="language-css"></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">padding</span>: <span class="number">10px</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">border</span>: <span class="number">1px</span> solid <span class="number">#ffa200</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">margin-bottom</span>: <span class="number">40px</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container</span> <span class="selector-class">.left</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">background-color</span>: <span class="number">#4b83e2</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container</span> <span class="selector-class">.right</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">background-color</span>: <span class="number">#ff3b30</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="comment">/*左浮动固定宽度，右边盒子overflow:hidden触发bfc，使其不与浮动盒子区域重叠，因此会重新计算宽度。*/</span></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container1</span> <span class="selector-class">.left</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">float</span>: left;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">width</span>: <span class="number">200px</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container1</span> <span class="selector-class">.right</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">overflow</span>: hidden;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="comment">/*清除浮动*/</span></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container1</span><span class="selector-pseudo">:after</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">content</span>: <span class="string">&quot;&quot;</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">height</span>: <span class="number">0</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">line-height</span>: <span class="number">0</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">display</span>: block;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">visibility</span>: hidden;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">clear</span>: both;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="comment">/*左浮动固定宽度,右边margin-left*/</span></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container2</span> <span class="selector-class">.left</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">float</span>: left;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">width</span>: <span class="number">200px</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container2</span> <span class="selector-class">.right</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">margin-left</span>: <span class="number">200px</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="comment">/*清除浮动*/</span></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container2</span><span class="selector-pseudo">:after</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">content</span>: <span class="string">&quot;&quot;</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">height</span>: <span class="number">0</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">line-height</span>: <span class="number">0</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">display</span>: block;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">visibility</span>: hidden;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">clear</span>: both;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="comment">/*左边绝对定位，右边设置margin-left，缺点：当左边高于右边时，左边会超出父元素，需要使用js补救。*/</span></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container3</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">position</span>: relative;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container3</span> <span class="selector-class">.left</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">position</span>: absolute;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">left</span>: <span class="number">10px</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">top</span>: <span class="number">10px</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">width</span>: <span class="number">200px</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container3</span> <span class="selector-class">.right</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">margin-left</span>: <span class="number">200px</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="comment">/*双display:inline-block*/</span></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container4</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">font-size</span>: <span class="number">0</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container4</span> <span class="selector-class">.left</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">width</span>: <span class="number">200px</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container4</span> <span class="selector-class">.left</span>,</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container4</span> <span class="selector-class">.right</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">display</span>: inline-block;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">font-size</span>: <span class="number">16px</span>;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">vertical-align</span>: top;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container4</span> <span class="selector-class">.right</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">width</span>: <span class="built_in">calc</span>(<span class="number">100%</span> - <span class="number">200px</span>);</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="comment">/*table*/</span></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container5</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">display</span>: table;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container5</span> <span class="selector-class">.left</span>,</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container5</span> <span class="selector-class">.right</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">display</span>: table-cell;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="comment">/*flex*/</span></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container6</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">display</span>: flex;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container6</span> <span class="selector-class">.right</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">flex-grow</span>: <span class="number">1</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="comment">/*grid*/</span></span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container7</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">display</span>: grid;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container7</span> <span class="selector-class">.left</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">grid-column</span>: <span class="number">1</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css">	<span class="selector-class">.container7</span> <span class="selector-class">.right</span> &#123;</span></span><br><span class="line"><span class="language-css">		<span class="attribute">grid-column</span>: <span class="number">2</span>;</span></span><br><span class="line"><span class="language-css">	&#125;</span></span><br><span class="line"><span class="language-css"></span><span class="tag">&lt;/<span class="name">style</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;container container1&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;left&quot;</span>&gt;</span>左边左边左边左边左边左边左边左边左边左边<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;right&quot;</span>&gt;</span></span><br><span class="line">		右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边</span><br><span class="line">	<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;container container2&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;left&quot;</span>&gt;</span>左边左边左边左边左边左边左边左边左边左边<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;right&quot;</span>&gt;</span></span><br><span class="line">		右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边</span><br><span class="line">	<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;container container3&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;left&quot;</span>&gt;</span>左边左边左边左边左边左边左边左边左边左边<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;right&quot;</span>&gt;</span></span><br><span class="line">		右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边</span><br><span class="line">	<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;container container4&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;left&quot;</span>&gt;</span>左边左边左边左边左边左边左边左边左边左边<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;right&quot;</span>&gt;</span></span><br><span class="line">		右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边</span><br><span class="line">	<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;container container5&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;left&quot;</span>&gt;</span>左边左边左边左边左边左边左边左边左边左边<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;right&quot;</span>&gt;</span></span><br><span class="line">		右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边</span><br><span class="line">	<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;container container6&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;left&quot;</span>&gt;</span>左边左边左边左边左边左边左边左边左边左边<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;right&quot;</span>&gt;</span></span><br><span class="line">		右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边</span><br><span class="line">	<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;container container7&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;left&quot;</span>&gt;</span>左边左边左边左边左边左边左边左边左边左边<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;right&quot;</span>&gt;</span></span><br><span class="line">		右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边右边</span><br><span class="line">	<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h4 id="display：inline-block-什么时候会显示间隙？"><a href="#display：inline-block-什么时候会显示间隙？" class="headerlink" title="display：inline-block 什么时候会显示间隙？"></a>display：inline-block 什么时候会显示间隙？</h4><blockquote>
<p><strong>间隙产生的原因是因为，换行或空格会占据一定的位置</strong></p>
</blockquote>
<p>​ <strong>解决</strong>：夫元素设置：</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">font-size</span>: <span class="number">0</span>;</span><br><span class="line">letter-spaceing: -<span class="number">4px</span>;</span><br></pre></td></tr></table></figure>

<h4 id="overflow-有哪些属性值？"><a href="#overflow-有哪些属性值？" class="headerlink" title="overflow 有哪些属性值？"></a>overflow 有哪些属性值？</h4><ul>
<li><strong>visible</strong>: 默认值。内容不会被修剪，会呈现在元素框之外。</li>
<li><strong>hidden</strong>: 内容会被修剪，并且其余内容是不可见的。</li>
<li><strong>scroll</strong>: 内容会被修剪，但是浏览器会显示滚动条以便查看其余的内容。</li>
<li><strong>auto</strong>: 如果内容被修剪，则浏览器会显示滚动条以便查看其余的内容。</li>
<li><strong>inherit</strong>: 规定应该从父元素继承 overflow 属性的值。</li>
</ul>
<h4 id="css-去掉-iPhone、iPad-默认按钮样式"><a href="#css-去掉-iPhone、iPad-默认按钮样式" class="headerlink" title="css 去掉 iPhone、iPad 默认按钮样式"></a>css 去掉 iPhone、iPad 默认按钮样式</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">input</span><span class="selector-attr">[type=<span class="string">&quot;button&quot;</span>]</span>,</span><br><span class="line"><span class="selector-tag">input</span><span class="selector-attr">[type=<span class="string">&quot;submit&quot;</span>]</span>,</span><br><span class="line"><span class="selector-tag">input</span><span class="selector-attr">[type=<span class="string">&quot;reset&quot;</span>]</span> &#123;</span><br><span class="line">	-webkit-appearance: none;</span><br><span class="line">	-moz-appearance: none;</span><br><span class="line">	appearance: none;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="CSS-样式初始化的目的"><a href="#CSS-样式初始化的目的" class="headerlink" title="CSS 样式初始化的目的"></a>CSS 样式初始化的目的</h4><blockquote>
<ul>
<li><p>CSS 初始化是指重设浏览器的样式。不同的浏览器默认的样式可能不尽相同，所以开发时的第一件事可能就是如何把它们统一。如果没对 CSS 初始化往往会出现浏览器之间的页面差异。</p>
</li>
<li><p>每次新开发网站或新网页时候通过初始化 CSS 样式的属性，为我们将用到的 CSS 或 html 标签更加方便准确，使得我们开发网页内容时更加方便简洁，同时减少 CSS 代码量，节约网页下载时间。</p>
</li>
<li><p>初始化 CSS 为我们节约网页代码，节约网页下载时间；还会使得我们开发网页内容时更加方便简洁，不用考虑很多。</p>
</li>
<li><p>如果不初始化，整个页面做完会很糟糕，重复的 css 样式很多。</p>
</li>
</ul>
</blockquote>
<h4 id="用-div-css-网站布局的好处"><a href="#用-div-css-网站布局的好处" class="headerlink" title="用 div+css 网站布局的好处"></a>用 div+css 网站布局的好处</h4><ul>
<li><p>div+css 布局比 table 布局节省页面代码，代码结构也更清晰明了.</p>
</li>
<li><p>div+css 的页面对搜索引擎支持好，而且速度更快了,能够比 table 更加快速的显示网站内容.</p>
</li>
<li><p>div+css 布局使网站版面布局修改变的更简单,因为版面代码都写在独立的 css 文件里修改起来方便多了,不象 table 要在页面中修改很多信息.</p>
</li>
</ul>
<h4 id="用表格-table-对-seo-的影响"><a href="#用表格-table-对-seo-的影响" class="headerlink" title="用表格 table 对 seo 的影响"></a>用表格 table 对 seo 的影响</h4><blockquote>
<p>待补充。。。。。。</p>
</blockquote>
<h4 id="console-有哪些常用方法-（答出三种并说出它的用法即可，想考察你有没有工作经验）"><a href="#console-有哪些常用方法-（答出三种并说出它的用法即可，想考察你有没有工作经验）" class="headerlink" title="console 有哪些常用方法?（答出三种并说出它的用法即可，想考察你有没有工作经验）"></a>console 有哪些常用方法?（答出三种并说出它的用法即可，想考察你有没有工作经验）</h4><ul>
<li><strong>console.log()</strong>: 最常用的</li>
<li><strong>console.dir()</strong>: 将传入对象的属性，包括子对象的属性以列表形式输出</li>
<li><strong>console.assert()</strong>: 接收至少两个参数，第一个参数的值或返回值为<code>false</code>的时候，将会在控制台上输出后续参数的值。</li>
<li><strong>console.count()</strong>: 输出执行到该行的次数，可选参数 label 可以输出在次数之前</li>
<li><strong>console.error()</strong>:用于输出错误信息，用法和常见的<code>console.log</code>一样，不同点在于输出内容会标记为错误的样式，便于分辨。</li>
</ul>
<h4 id="为什么利用多个域名来存储网站资源会更有效？"><a href="#为什么利用多个域名来存储网站资源会更有效？" class="headerlink" title="为什么利用多个域名来存储网站资源会更有效？"></a>为什么利用多个域名来存储网站资源会更有效？</h4><ul>
<li><p>CDN 缓存更方便</p>
</li>
<li><p>突破浏览器并发限制</p>
</li>
<li><p>节约 cookie 带宽</p>
</li>
<li><p>节约主域名的连接数，优化页面响应速度</p>
</li>
<li><p>防止不必要的安全问题</p>
</li>
</ul>
<h4 id="网页的重绘与重排以及重构"><a href="#网页的重绘与重排以及重构" class="headerlink" title="网页的重绘与重排以及重构"></a>网页的重绘与重排以及重构</h4><ul>
<li><p><strong>重绘</strong>: 浏览器加载文档</p>
<blockquote>
<p>浏览器从下载文档到显示页面的过程是个复杂的过程，这里包含了重绘和重排。各家浏览器引擎的工作原理略有差别，但也有一定规则。简单讲，通常在文档初次加载时，浏览器引擎会解析 HTML 文档来构建 DOM 树，之后根据 DOM 元素的几何属性构建一棵用于渲染的树。渲染树的每个节点都有大小和边距等属性，类似于盒子模型（由于隐藏元素不需要显示，渲染树中并不包含 DOM 树中隐藏的元素）。当渲染树构建完成后，浏览器就可以将元素放置到正确的位置了，再根据渲染树节点的样式属性绘制出页面。由于浏览器的流布局，对渲染树的计算通常只需要遍历一次就可以完成。但 table 及其内部元素除外，它可能需要多次计算才能确定好其在渲染树中节点的属性，通常要花 3 倍于同等元素的时间。这也是为什么我们要避免使用 table 做布局的一个原因。</p>
<p>重绘是一个 **元素外观 ** 的改变所触发的浏览器行为，例如改变 visibility、outline、背景色等属性。浏览器会根据元素的新属性重新绘制，使元素呈现新的外观。重绘不会带来重新布局，并不一定伴随重排。</p>
</blockquote>
</li>
<li><p><strong>重排（回流）</strong>: 重排是更明显的一种改变，可以理解为渲染树需要重新计算。</p>
<blockquote>
<ul>
<li><p><strong>DOM 元素的几何属性变化</strong></p>
<p>当 DOM 元素的几何属性变化时，渲染树中的相关节点就会失效，浏览器会根据 DOM 元素的变化重新构建渲染树中失效的节点.<br>重排一定会引起浏览器的重绘，一个元素的重排通常会带来一系列的反应，甚至触发整个文档的重排和重绘，性能代价是高昂的。</p>
</li>
<li><p><strong>DOM 树的结构变化</strong><br>当 DOM 树的结构变化时，例如节点的增减、移动等，也会触发重排。浏览器引擎布局的过程，类似于树的前序遍历，是一个从上到下从左到右的过程。通常在这个过程中，当前元素不会再影响其前面已经遍历过的元素。所以，如果在 body 最前面插入一个元素，会导致整个文档的重新渲染，而在其后插入一个元素，则不会影响到前面的元素。</p>
</li>
<li><p><strong>获取某些属性</strong><br>浏览器引擎可能会针对重排做了优化。比如 Opera，它会等到有足够数量的变化发生，或者等到一定的时间，或者等一个线程结束，再一起处理，这样就只发生一次重排。但除了渲染树的直接变化，当获取一些属性时，浏览器为取得正确的值也会触发重排。这样就使得浏览器的优化失效了。这些属性包括：offsetTop、offsetLeft、 offsetWidth、offsetHeight、scrollTop、scrollLeft、scrollWidth、scrollHeight、clientTop、clientLeft、clientWidth、clientHeight、getComputedStyle() (currentStyle in IE)。所以，在多次使用这些值时应进行缓存。</p>
</li>
<li><p><strong>其他</strong><br>改变浏览器窗口大小、改变一些元素的样式</p>
</li>
</ul>
</blockquote>
</li>
<li><p><strong>重构</strong>: 一般指项目重构，换框架等等</p>
</li>
</ul>
<h4 id="谈谈以前端角度出发做好-SEO-需要考虑什么"><a href="#谈谈以前端角度出发做好-SEO-需要考虑什么" class="headerlink" title="谈谈以前端角度出发做好 SEO 需要考虑什么"></a>谈谈以前端角度出发做好 SEO 需要考虑什么</h4><ul>
<li>经常更新网站内容，优质的原创内容越多，搜索引擎收录越多，权重越高。</li>
<li>优化 meta 标签的关键词，启用 Keep-Alive；为每个页面单独命名，要符合页面内容。</li>
<li>优化网站、代码结构，简洁，清晰，结构鲜明的代码容易被搜索引擎爬取。</li>
<li>确保每个页面都可以通过至少一个文本链接到达</li>
<li>重要的内容，应该能从首页或者网站结构中比较浅的层次访问到</li>
<li>使用文字而不是 flash、图片、Javascript 等来显示重要的内容或链接，为图片的 alt 添加文本。</li>
<li><pre><code>......
</code></pre>
</li>
</ul>
<h4 id="rgba-和-opacity-的透明效果有什么不同？"><a href="#rgba-和-opacity-的透明效果有什么不同？" class="headerlink" title="rgba()和 opacity 的透明效果有什么不同？"></a>rgba()和 opacity 的透明效果有什么不同？</h4><ul>
<li><code>opacity</code> 是属性，<code>rgba()</code>是函数，计算之后是个属性值；</li>
<li><code>opacity</code> 作用于元素和元素的内容，内容会继承元素的透明度，取值 0-1；</li>
<li><code>rgba()</code> 一般作为背景色 <code>background-color</code> 或者颜色 <code>color</code> 的属性值，透明度由其中的 <code>alpha</code> 值生效，取值 0-1；</li>
</ul>
<h4 id="Sass、LESS-是什么？大家为什么要使用他们？"><a href="#Sass、LESS-是什么？大家为什么要使用他们？" class="headerlink" title="Sass、LESS 是什么？大家为什么要使用他们？"></a>Sass、LESS 是什么？大家为什么要使用他们？</h4><blockquote>
<p>CSS 预处理器。他是 CSS 上的一种抽象层。他们是一种特殊的语法&#x2F;语言编译成 CSS。</p>
</blockquote>
<ul>
<li><p>结构清晰，便于扩展。</p>
</li>
<li><p>可以方便地屏蔽浏览器私有语法差异。这个不用多说，封装对浏览器语法差异的重复处理，减少无意义的机械劳动。</p>
</li>
<li><p>可以轻松实现多重继承。</p>
</li>
<li><p>完全兼容 CSS 代码，可以方便地应用到老项目中。LESS 只是在 CSS 语法上做了扩展，所以老的 CSS 代码也可以与 LESS 代码一同编译。</p>
</li>
</ul>
<h4 id="行内元素有哪些？块级元素有哪些？空-void-元素有那些？样式之间的转换"><a href="#行内元素有哪些？块级元素有哪些？空-void-元素有那些？样式之间的转换" class="headerlink" title="行内元素有哪些？块级元素有哪些？空(void)元素有那些？样式之间的转换"></a>行内元素有哪些？块级元素有哪些？空(void)元素有那些？样式之间的转换</h4><ul>
<li><strong>行内元素</strong>: a、b、span、img、input、strong、select、label、em、button、textarea</li>
<li><strong>块级元素</strong>:div、ul、li、dl、dt、dd、p、h1-h6</li>
<li><strong>空元素</strong>:即系没有内容的 HTML 元素，例如：br、meta、hr、link、input、img</li>
</ul>
<blockquote>
<p>强制转换成块元素<br>display：block<br>强制转换成行内元素<br>display：inline<br>强制转换成行内扩张元素<br>display：inline-block</p>
</blockquote>
<h4 id="CSS3-新特性有哪些？"><a href="#CSS3-新特性有哪些？" class="headerlink" title="CSS3 新特性有哪些？"></a>CSS3 新特性有哪些？</h4><ul>
<li><strong>弹性布局 flex</strong></li>
<li><strong>栅格布局 grid</strong></li>
<li><strong>选择器</strong></li>
<li><strong>过渡</strong></li>
<li><strong>动画</strong></li>
<li><strong>媒体查询</strong></li>
</ul>
<h4 id="CSS3-选择器有哪些？"><a href="#CSS3-选择器有哪些？" class="headerlink" title="CSS3 选择器有哪些？"></a>CSS3 选择器有哪些？</h4><ul>
<li><strong>属性选择器</strong></li>
<li><strong>结构性伪类选择器—root</strong>: 等同于<code>&lt;html&gt;</code>元素</li>
<li><strong>结构性伪类选择器—not</strong>: 可以选择除某个元素之外的所有元素</li>
<li><strong>结构性伪类选择器—empty</strong>:用来选择没有任何内容的元素</li>
<li><strong>结构性伪类选择器—target</strong>: 用来匹配文档(页面)的 url 的某个标志符的目标元素。</li>
<li><strong>结构性伪类选择器—first-child</strong>: 选择元素中的第一个子元素</li>
<li><strong>结构性伪类选择器—last-child</strong>:选择元素的最后一个子元素</li>
<li><strong>结构性伪类选择器—nth-child(n)</strong>:定位某个父元素的一个或多个特定的子元素</li>
<li><strong>only-child 选择器</strong>:选择父元素中只有一个子元素，而且只有唯一的一个子元素。</li>
<li>……</li>
</ul>
<h4 id="移动端优先使用弹性布局（flex）来解决布局问题，请列出弹性布局的相关属性，并说明属性用途"><a href="#移动端优先使用弹性布局（flex）来解决布局问题，请列出弹性布局的相关属性，并说明属性用途" class="headerlink" title="移动端优先使用弹性布局（flex）来解决布局问题，请列出弹性布局的相关属性，并说明属性用途"></a>移动端优先使用弹性布局（flex）来解决布局问题，请列出弹性布局的相关属性，并说明属性用途</h4><ul>
<li><strong>flex-direction</strong></li>
</ul>
<blockquote>
<p>flex-direction 属性决定主轴的方向（即项目的排列方向）。</p>
<ul>
<li><p><code>row</code>（默认值）：主轴为水平方向，起点在左端。</p>
</li>
<li><p><code>row-reverse</code>：主轴为水平方向，起点在右端。</p>
</li>
<li><p><code>column</code>：主轴为垂直方向，起点在上沿。</p>
</li>
<li><p><code>column-reverse</code>：主轴为垂直方向，起点在下沿。</p>
</li>
</ul>
</blockquote>
<ul>
<li><strong>flex-wrap</strong></li>
</ul>
<blockquote>
<p>flex-wrap 属性定义，如果一条轴线排不下，如何换行。</p>
<ul>
<li><code>nowrap</code>（默认）：不换行。</li>
<li><code>wrap</code>：换行，第一行在上方。</li>
<li><code>wrap-reverse</code>：换行，第一行在下方。</li>
</ul>
</blockquote>
<ul>
<li><strong>flex-flow</strong></li>
</ul>
<blockquote>
<p><code>flex-flow</code>属性是<code>flex-direction</code>属性和<code>flex-wrap</code>属性的简写形式，默认值为<code>row nowrap</code>。</p>
</blockquote>
<ul>
<li><strong>justify-content</strong>:</li>
</ul>
<blockquote>
<p><code>justify-content</code>属性定义了项目在主轴上的对齐方式。</p>
<ul>
<li><code>flex-start</code>（默认值）：左对齐</li>
<li><code>flex-end</code>：右对齐</li>
<li><code>center</code>： 居中</li>
<li><code>space-between</code>：两端对齐，项目之间的间隔都相等。</li>
<li><code>space-around</code>：每个项目两侧的间隔相等。所以，项目之间的间隔比项目与边框的间隔大一倍。</li>
</ul>
</blockquote>
<ul>
<li><strong>align-items</strong></li>
</ul>
<blockquote>
<p><code>align-items</code>属性定义项目在交叉轴上如何对齐。</p>
<ul>
<li><code>flex-start</code>：交叉轴的起点对齐。</li>
<li><code>flex-end</code>：交叉轴的终点对齐。</li>
<li><code>center</code>：交叉轴的中点对齐。</li>
<li><code>baseline</code>: 项目的第一行文字的基线对齐。</li>
<li><code>stretch</code>（默认值）：如果项目未设置高度或设为 auto，将占满整个容器的高度。</li>
</ul>
</blockquote>
<ul>
<li><strong>align-content</strong></li>
</ul>
<blockquote>
<p>​ <code>align-content</code>属性定义了多根轴线的对齐方式。如果项目只有一根轴线，该属性不起作用。</p>
<ul>
<li><code>flex-start</code>：与交叉轴的起点对齐。</li>
<li><code>flex-end</code>：与交叉轴的终点对齐。</li>
<li><code>center</code>：与交叉轴的中点对齐。</li>
<li><code>space-between</code>：与交叉轴两端对齐，轴线之间的间隔平均分布。</li>
<li><code>space-around</code>：每根轴线两侧的间隔都相等。所以，轴线之间的间隔比轴线与边框的间隔大一倍。</li>
<li><code>stretch</code>（默认值）：轴线占满整个交叉轴。</li>
</ul>
</blockquote>
<h4 id="CSS3-的兼容问题怎么处理？"><a href="#CSS3-的兼容问题怎么处理？" class="headerlink" title="CSS3 的兼容问题怎么处理？"></a>CSS3 的兼容问题怎么处理？</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">-moz-<span class="attribute">border-radius</span>: <span class="number">2px</span>; <span class="comment">/* Firefox */</span></span><br><span class="line">-webkit-<span class="attribute">border-radius</span>: <span class="number">2px</span>; <span class="comment">/* Safari 和 Chrome */</span></span><br><span class="line"><span class="attribute">border-radius</span>: <span class="number">2px</span>; <span class="comment">/* Opera 10.5+, 以及使用了IE-CSS3的IE浏览器 */</span></span><br><span class="line">-o-<span class="attribute">border-radius</span>: <span class="number">2px</span>;</span><br><span class="line">-khtml-<span class="attribute">border-radius</span>: <span class="number">2px</span>; <span class="comment">/* 针对Konqueror浏览器 */</span></span><br></pre></td></tr></table></figure>

<h4 id="CSS3-动画和-JS-动画主要的不同点是什么？"><a href="#CSS3-动画和-JS-动画主要的不同点是什么？" class="headerlink" title="CSS3 动画和 JS 动画主要的不同点是什么？"></a>CSS3 动画和 JS 动画主要的不同点是什么？</h4><ul>
<li><strong>CSS 动画</strong></li>
</ul>
<blockquote>
<p><strong>优点</strong>:</p>
<p>浏览器可以对动画进行优化。</p>
<p>浏览器使用与 requestAnimationFrame 类似的机制，requestAnimationFrame 比起 setTimeout，setInterval 设置动画的优势主要是:</p>
<ul>
<li>requestAnimationFrame 会把每一帧中的所有 DOM 操作集中起来，在一次重绘或回流中就完成,并且重绘或回流的时间间隔紧紧跟随浏览器的刷新频率,一般来说,这个频率为每秒 60 帧。</li>
<li>在隐藏或不可见的元素中 requestAnimationFrame 不会进行重绘或回流，这当然就意味着更少的的 cpu，gpu 和内存使用量。</li>
</ul>
<p>强制使用硬件加速 （通过 GPU 来提高动画性能）</p>
<p><strong>缺点</strong>:</p>
<ul>
<li>运行过程控制较弱,无法附加事件绑定回调函数。CSS 动画只能暂停,不能在动画中寻找一个特定的时间点，不能在半路反转动画，不能变换时间尺度，不能在特定的位置添加回调函数或是绑定回放事件,无进度报告</li>
<li>代码冗长。想用 CSS 实现稍微复杂一点动画,最后 CSS 代码都会变得非常笨重。</li>
</ul>
</blockquote>
<ul>
<li><strong>JS 动画</strong></li>
</ul>
<blockquote>
<p><strong>优点</strong>:</p>
<ul>
<li>JavaScript 动画控制能力很强, 可以在动画播放过程中对动画进行控制：开始、暂停、回放、终止、取消都是可以做到的。</li>
<li>JS 动画的效果比 css3 动画丰富,有些动画效果，比如曲线运动,冲击闪烁,视差滚动效果，只有 JavaScript 动画才能完成</li>
<li>CSS3 有兼容性问题，而 JS 大多时候没有兼容性问题</li>
</ul>
<p><strong>缺点</strong>:</p>
<ul>
<li>JavaScript 在浏览器的主线程中运行，而主线程中还有其它需要运行的 JavaScript 脚本、样式计算、布局、绘制任务等,对其干扰导致线程可能出现阻塞，从而造成丢帧的情况。</li>
<li>JS 动画代码的复杂度高于 CSS 动画</li>
</ul>
</blockquote>
<h4 id="请用-Css-写一个简单的幻灯片效果页面"><a href="#请用-Css-写一个简单的幻灯片效果页面" class="headerlink" title="请用 Css 写一个简单的幻灯片效果页面"></a>请用 Css 写一个简单的幻灯片效果页面</h4><blockquote>
<p>…….</p>
</blockquote>
<h4 id="Rem-的使用方法"><a href="#Rem-的使用方法" class="headerlink" title="Rem 的使用方法"></a>Rem 的使用方法</h4><ul>
<li><p>简易 JS</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">(<span class="keyword">function</span> (<span class="params">doc, win</span>) &#123;</span><br><span class="line">	<span class="keyword">var</span> docEl = doc.<span class="property">documentElement</span>,</span><br><span class="line">		resizeEvt =</span><br><span class="line">			<span class="string">&quot;orientationchange&quot;</span> <span class="keyword">in</span> <span class="variable language_">window</span> ? <span class="string">&quot;orientationchange&quot;</span> : <span class="string">&quot;resize&quot;</span>,</span><br><span class="line">		recalc = <span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line">			<span class="keyword">if</span> (docEl.<span class="property">clientWidth</span> &gt; <span class="number">750</span>) &#123;</span><br><span class="line">				docEl.<span class="property">style</span>.<span class="property">fontSize</span> = <span class="string">&quot;100px&quot;</span>;</span><br><span class="line">				doc.<span class="title function_">getElementById</span>(<span class="string">&quot;app&quot;</span>).<span class="property">style</span>.<span class="property">width</span> = <span class="string">&quot;750px&quot;</span>;</span><br><span class="line">			&#125; <span class="keyword">else</span> &#123;</span><br><span class="line">				<span class="keyword">var</span> width = docEl.<span class="property">clientWidth</span> / <span class="number">7.5</span>;</span><br><span class="line">				docEl.<span class="property">style</span>.<span class="property">fontSize</span> = width + <span class="string">&quot;px&quot;</span>;</span><br><span class="line">				doc.<span class="title function_">getElementById</span>(<span class="string">&quot;app&quot;</span>).<span class="property">style</span>.<span class="property">width</span> = <span class="string">&quot;auto&quot;</span>;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;;</span><br><span class="line">	<span class="keyword">if</span> (!doc.<span class="property">addEventListener</span>) <span class="keyword">return</span>;</span><br><span class="line">	win.<span class="title function_">addEventListener</span>(resizeEvt, recalc, <span class="literal">false</span>);</span><br><span class="line">	doc.<span class="title function_">addEventListener</span>(<span class="string">&quot;DOMContentLoaded&quot;</span>, recalc, <span class="literal">false</span>);</span><br><span class="line">&#125;)(<span class="variable language_">document</span>, <span class="variable language_">window</span>);</span><br></pre></td></tr></table></figure>
</li>
<li><p>postcss-px2rem</p>
</li>
</ul>
<h4 id="用-css-画一个三角形，圆，椭圆？"><a href="#用-css-画一个三角形，圆，椭圆？" class="headerlink" title="用 css 画一个三角形，圆，椭圆？"></a>用 css 画一个三角形，圆，椭圆？</h4><blockquote>
<p>……</p>
</blockquote>
<h4 id="html5-有哪些新特性、移除了那些元素？如何处理-HTML5-新标签的浏览器兼容问题？"><a href="#html5-有哪些新特性、移除了那些元素？如何处理-HTML5-新标签的浏览器兼容问题？" class="headerlink" title="html5 有哪些新特性、移除了那些元素？如何处理 HTML5 新标签的浏览器兼容问题？"></a>html5 有哪些新特性、移除了那些元素？如何处理 HTML5 新标签的浏览器兼容问题？</h4><p><strong>html5 新增</strong></p>
<ul>
<li>语义化标签</li>
<li>增强型表单</li>
<li>新增视频 <code>&lt;video&gt;</code> 和音频 <code>&lt;audio&gt;</code> 标签</li>
<li>Canvas 绘图</li>
<li>SVG 绘图</li>
<li>地理定位</li>
<li>拖放 API</li>
<li>Web Worker</li>
<li>Web Storage</li>
<li>WebSocket</li>
</ul>
<p><strong>新元素</strong></p>
<ul>
<li>header</li>
<li>footer</li>
<li>nav</li>
<li>section</li>
<li>time</li>
<li>aside</li>
<li>……</li>
</ul>
<p><strong>移除的元素</strong></p>
<ul>
<li>纯表现的元素：basefont，big，center，font, s，strike，tt，u；</li>
<li>对可用性产生负面影响的元素：frame，frameset，noframes；</li>
</ul>
<h4 id="HTML5-中新增的操作-DOM-的方法？"><a href="#HTML5-中新增的操作-DOM-的方法？" class="headerlink" title="HTML5 中新增的操作 DOM 的方法？"></a>HTML5 中新增的操作 DOM 的方法？</h4><ul>
<li>document.querySelector(“ “);　　 单个元素获取</li>
<li>document.querySelectorAll(“ “); 　　多个元素获取</li>
<li>加：</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">box.classList.add(&quot;active&quot;);</span><br></pre></td></tr></table></figure>

<ul>
<li>删：</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">box.classList.remove(&quot;active&quot;);</span><br></pre></td></tr></table></figure>

<ul>
<li>判断：</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">box.classList.contains(&quot;active&quot;)； &gt;&gt;&gt;&gt;返回值是一个布尔值，true or false</span><br></pre></td></tr></table></figure>

<ul>
<li>切换：</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">box.classList.toggle(&quot;active&quot;);</span><br></pre></td></tr></table></figure>

<h4 id="image-和-canvas-在处理图片的时候有什么区别？"><a href="#image-和-canvas-在处理图片的时候有什么区别？" class="headerlink" title="image 和 canvas 在处理图片的时候有什么区别？"></a>image 和 canvas 在处理图片的时候有什么区别？</h4><blockquote>
<p>……</p>
</blockquote>
<h4 id="HTML5-中的本地存储概念是什么？生命周期有多长？"><a href="#HTML5-中的本地存储概念是什么？生命周期有多长？" class="headerlink" title="HTML5 中的本地存储概念是什么？生命周期有多长？"></a>HTML5 中的本地存储概念是什么？生命周期有多长？</h4><blockquote>
<p>html5 中的 Web Storage 包括了两种存储方式：sessionStorage 和 localStorage。</p>
<p>sessionStorage 用于本地存储一个会话中的数据，这些数据只有在同一个会话中的页面才能访问并且当会话结束后数据也随之销毁，因此 sessionStorage 不是一种持久化的本地存储，仅仅是会话级别的存储。</p>
<p>而 localStorage 用于持久化的本地存储，除非主动删除数据，否则数据是永远不会过期的。</p>
<p>cookie 是网站为了标示用户身份而储存在用户本地终端上的数据（通常经过加密）。</p>
</blockquote>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://leiboy.gitee.io/blog">破破</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://leiboy.gitee.io/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/">https://leiboy.gitee.io/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://leiboy.gitee.io/blog" target="_blank">破破的QQ空间</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/blog/tags/HTML/">HTML</a><a class="post-meta__tags" href="/blog/tags/CSS/">CSS</a></div><div class="post_share"><div class="social-share" data-image="/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/csslogo.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1.1.3/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1.1.3/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/blog/2022/07/13/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%9D%A2%E8%AF%95%E9%A2%98/" title="小程序面试题"><img class="cover" src="/blog/2022/07/13/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%9D%A2%E8%AF%95%E9%A2%98/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%9B%BE%E6%A0%87.jpeg" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">小程序面试题</div></div></a></div><div class="next-post pull-right"><a href="/blog/2022/07/09/JS%E9%9D%A2%E8%AF%95%E9%A2%98%E6%B1%87%E6%80%BB/" title="JS面试题汇总"><img class="cover" src="/blog/2022/07/09/JS%E9%9D%A2%E8%AF%95%E9%A2%98%E6%B1%87%E6%80%BB/js%E5%9B%BE%E7%89%87.png" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">JS面试题汇总</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="this.onerror=null;this.src='/blog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">破破</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">10</div></a><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">7</div></a><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%80%8E%E4%B9%88%E8%AE%A9%E4%B8%80%E4%B8%AA%E4%B8%8D%E5%AE%9A%E5%AE%BD%E9%AB%98%E7%9A%84-DIV%EF%BC%8C%E5%9E%82%E7%9B%B4%E6%B0%B4%E5%B9%B3%E5%B1%85%E4%B8%AD%EF%BC%9F"><span class="toc-number">1.</span> <span class="toc-text">怎么让一个不定宽高的 DIV，垂直水平居中？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#position-%E5%87%A0%E4%B8%AA%E5%B1%9E%E6%80%A7%E7%9A%84%E4%BD%9C%E7%94%A8%EF%BC%9F"><span class="toc-number">2.</span> <span class="toc-text">position 几个属性的作用？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#px%EF%BC%8Cem%EF%BC%8Crem-%E7%9A%84%E5%8C%BA%E5%88%AB%EF%BC%9F"><span class="toc-number">3.</span> <span class="toc-text">px，em，rem 的区别？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BB%80%E4%B9%88%E6%98%AF-BFC%EF%BC%9F"><span class="toc-number">4.</span> <span class="toc-text">什么是 BFC？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#CSS-%E5%BC%95%E5%85%A5%E7%9A%84%E6%96%B9%E5%BC%8F%E6%9C%89%E5%93%AA%E4%BA%9B-link-%E5%92%8C-import-%E7%9A%84%E5%8C%BA%E5%88%AB%E6%98%AF"><span class="toc-number">5.</span> <span class="toc-text">CSS 引入的方式有哪些? link 和@import 的区别是?</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%8F%8F%E8%BF%B0-css-reset-%E7%9A%84%E4%BD%9C%E7%94%A8%E5%92%8C%E7%94%A8%E9%80%94%EF%BC%9F"><span class="toc-number">6.</span> <span class="toc-text">描述 css reset 的作用和用途？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%A7%A3%E9%87%8A-css-sprites%EF%BC%8C%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%EF%BC%9F"><span class="toc-number">7.</span> <span class="toc-text">解释 css sprites，如何使用？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B8%85%E9%99%A4%E6%B5%AE%E5%8A%A8%E7%9A%84%E5%87%A0%E7%A7%8D%E6%96%B9%E5%BC%8F%EF%BC%9F"><span class="toc-number">8.</span> <span class="toc-text">清除浮动的几种方式？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%83%BD%E5%90%A6%E7%AE%80%E8%BF%B0%E4%B8%80%E4%B8%8B%E5%A6%82%E4%BD%95%E4%BD%BF%E4%B8%80%E5%A5%97%E8%AE%BE%E8%AE%A1%E6%96%B9%E6%A1%88%EF%BC%8C%E9%80%82%E5%BA%94%E4%B8%8D%E5%90%8C%E7%9A%84%E5%88%86%E8%BE%A8%E7%8E%87%EF%BC%8C%E6%9C%89%E5%93%AA%E4%BA%9B%E6%96%B9%E6%B3%95%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%EF%BC%9F"><span class="toc-number">9.</span> <span class="toc-text">能否简述一下如何使一套设计方案，适应不同的分辨率，有哪些方法可以实现？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%A0%E8%83%BD%E6%8F%8F%E8%BF%B0%E4%B8%80%E4%B8%8B%E6%B8%90%E8%BF%9B%E5%A2%9E%E5%BC%BA%E5%92%8C%E4%BC%98%E9%9B%85%E9%99%8D%E7%BA%A7%E4%B9%8B%E9%97%B4%E7%9A%84%E4%B8%8D%E5%90%8C%E5%90%97%EF%BC%9F"><span class="toc-number">10.</span> <span class="toc-text">你能描述一下渐进增强和优雅降级之间的不同吗？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%90%88%E7%90%86%E7%9A%84%E9%A1%B5%E9%9D%A2%E5%B8%83%E5%B1%80%E4%B8%AD%E5%B8%B8%E5%90%AC%E8%BF%87%E7%BB%93%E6%9E%84%E4%B8%8E%E8%A1%A8%E7%8E%B0%E5%88%86%E7%A6%BB%EF%BC%8C%E9%82%A3%E4%B9%88%E7%BB%93%E6%9E%84%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F%E8%A1%A8%E7%8E%B0%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="toc-number">11.</span> <span class="toc-text">合理的页面布局中常听过结构与表现分离，那么结构是什么？表现是什么？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%AE%80%E8%BF%B0%E5%AF%B9-Web-%E8%AF%AD%E4%B9%89%E5%8C%96%E7%9A%84%E7%90%86%E8%A7%A3%EF%BC%9F"><span class="toc-number">12.</span> <span class="toc-text">简述对 Web 语义化的理解？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#CSS-%E9%83%BD%E6%9C%89%E5%93%AA%E4%BA%9B%E9%80%89%E6%8B%A9%E5%99%A8%EF%BC%9FCSS-%E9%80%89%E6%8B%A9%E5%99%A8%E7%9A%84%E4%BC%98%E5%85%88%E7%BA%A7%E6%98%AF%E6%80%8E%E4%B9%88%E6%A0%B7%E5%AE%9A%E4%B9%89%E7%9A%84%EF%BC%9F"><span class="toc-number">13.</span> <span class="toc-text">CSS 都有哪些选择器？CSS 选择器的优先级是怎么样定义的？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#display%EF%BC%9A-none%EF%BC%9B%E4%B8%8E-visibility%EF%BC%9A-hidden-%E7%9A%84%E5%8C%BA%E5%88%AB%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="toc-number">14.</span> <span class="toc-text">display： none；与 visibility： hidden 的区别是什么？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%94%A8-CSS-%E5%AE%9A%E4%B9%89-p-%E6%A0%87%E7%AD%BE%EF%BC%8C%E8%A6%81%E6%B1%82%E5%AE%9E%E7%8E%B0%E4%BB%A5%E4%B8%8B%E6%95%88%E6%9E%9C%EF%BC%9A%E5%AD%97%E4%BD%93%E9%A2%9C%E8%89%B2%E5%9C%A8-IE6-%E4%B8%8B%E4%B8%BA%E9%BB%91%E8%89%B2-000000-%EF%BC%9BIE7-%E4%B8%8B%E4%B8%BA%E7%BA%A2%E8%89%B2-ff0000-%EF%BC%9B%E8%80%8C%E5%85%B6%E4%BB%96%E6%B5%8F%E8%A7%88%E5%99%A8%E4%B8%8B%E4%B8%BA%E7%BB%BF%E8%89%B2-00ff00"><span class="toc-number">15.</span> <span class="toc-text">用 CSS 定义 p 标签，要求实现以下效果：字体颜色在 IE6 下为黑色(#000000)；IE7 下为红色(#ff0000)；而其他浏览器下为绿色(#00ff00)</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#HTML-%E4%B8%8E-XHTML%E2%80%94%E2%80%94%E4%BA%8C%E8%80%85%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB"><span class="toc-number">16.</span> <span class="toc-text">HTML 与 XHTML——二者有什么区别</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Doctype-%E4%BD%9C%E7%94%A8-%E4%B8%A5%E6%A0%BC%E6%A8%A1%E5%BC%8F%E4%B8%8E%E6%B7%B7%E6%9D%82%E6%A8%A1%E5%BC%8F-%E5%A6%82%E4%BD%95%E8%A7%A6%E5%8F%91%E8%BF%99%E4%B8%A4%E7%A7%8D%E6%A8%A1%E5%BC%8F%EF%BC%8C%E5%8C%BA%E5%88%86%E5%AE%83%E4%BB%AC%E6%9C%89%E4%BD%95%E6%84%8F%E4%B9%89"><span class="toc-number">17.</span> <span class="toc-text">Doctype 作用? 严格模式与混杂模式-如何触发这两种模式，区分它们有何意义?</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%9B%92%E6%A8%A1%E5%9E%8B%EF%BC%9A"><span class="toc-number">18.</span> <span class="toc-text">盒模型：</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Css-Hack%EF%BC%9Fie6-7-8-%E7%9A%84-hack-%E5%88%86%E5%88%AB%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="toc-number">19.</span> <span class="toc-text">Css Hack？ie6,7,8 的 hack 分别是什么？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AF%B7%E7%94%A8-div-css-%E5%86%99%E5%87%BA%E5%B7%A6%E4%BE%A7%E5%9B%BA%E5%AE%9A-width-200px-%E5%8F%B3%E4%BE%A7%E8%87%AA%E9%80%82%E5%BA%94%E9%A1%B5%E9%9D%A2%E5%AE%BD%E5%BA%A6"><span class="toc-number">20.</span> <span class="toc-text">请用 div+css 写出左侧固定(width:200px;),右侧自适应页面宽度.</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#display%EF%BC%9Ainline-block-%E4%BB%80%E4%B9%88%E6%97%B6%E5%80%99%E4%BC%9A%E6%98%BE%E7%A4%BA%E9%97%B4%E9%9A%99%EF%BC%9F"><span class="toc-number">21.</span> <span class="toc-text">display：inline-block 什么时候会显示间隙？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#overflow-%E6%9C%89%E5%93%AA%E4%BA%9B%E5%B1%9E%E6%80%A7%E5%80%BC%EF%BC%9F"><span class="toc-number">22.</span> <span class="toc-text">overflow 有哪些属性值？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#css-%E5%8E%BB%E6%8E%89-iPhone%E3%80%81iPad-%E9%BB%98%E8%AE%A4%E6%8C%89%E9%92%AE%E6%A0%B7%E5%BC%8F"><span class="toc-number">23.</span> <span class="toc-text">css 去掉 iPhone、iPad 默认按钮样式</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#CSS-%E6%A0%B7%E5%BC%8F%E5%88%9D%E5%A7%8B%E5%8C%96%E7%9A%84%E7%9B%AE%E7%9A%84"><span class="toc-number">24.</span> <span class="toc-text">CSS 样式初始化的目的</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%94%A8-div-css-%E7%BD%91%E7%AB%99%E5%B8%83%E5%B1%80%E7%9A%84%E5%A5%BD%E5%A4%84"><span class="toc-number">25.</span> <span class="toc-text">用 div+css 网站布局的好处</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%94%A8%E8%A1%A8%E6%A0%BC-table-%E5%AF%B9-seo-%E7%9A%84%E5%BD%B1%E5%93%8D"><span class="toc-number">26.</span> <span class="toc-text">用表格 table 对 seo 的影响</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#console-%E6%9C%89%E5%93%AA%E4%BA%9B%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95-%EF%BC%88%E7%AD%94%E5%87%BA%E4%B8%89%E7%A7%8D%E5%B9%B6%E8%AF%B4%E5%87%BA%E5%AE%83%E7%9A%84%E7%94%A8%E6%B3%95%E5%8D%B3%E5%8F%AF%EF%BC%8C%E6%83%B3%E8%80%83%E5%AF%9F%E4%BD%A0%E6%9C%89%E6%B2%A1%E6%9C%89%E5%B7%A5%E4%BD%9C%E7%BB%8F%E9%AA%8C%EF%BC%89"><span class="toc-number">27.</span> <span class="toc-text">console 有哪些常用方法?（答出三种并说出它的用法即可，想考察你有没有工作经验）</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%B8%BA%E4%BB%80%E4%B9%88%E5%88%A9%E7%94%A8%E5%A4%9A%E4%B8%AA%E5%9F%9F%E5%90%8D%E6%9D%A5%E5%AD%98%E5%82%A8%E7%BD%91%E7%AB%99%E8%B5%84%E6%BA%90%E4%BC%9A%E6%9B%B4%E6%9C%89%E6%95%88%EF%BC%9F"><span class="toc-number">28.</span> <span class="toc-text">为什么利用多个域名来存储网站资源会更有效？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BD%91%E9%A1%B5%E7%9A%84%E9%87%8D%E7%BB%98%E4%B8%8E%E9%87%8D%E6%8E%92%E4%BB%A5%E5%8F%8A%E9%87%8D%E6%9E%84"><span class="toc-number">29.</span> <span class="toc-text">网页的重绘与重排以及重构</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%B0%88%E8%B0%88%E4%BB%A5%E5%89%8D%E7%AB%AF%E8%A7%92%E5%BA%A6%E5%87%BA%E5%8F%91%E5%81%9A%E5%A5%BD-SEO-%E9%9C%80%E8%A6%81%E8%80%83%E8%99%91%E4%BB%80%E4%B9%88"><span class="toc-number">30.</span> <span class="toc-text">谈谈以前端角度出发做好 SEO 需要考虑什么</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#rgba-%E5%92%8C-opacity-%E7%9A%84%E9%80%8F%E6%98%8E%E6%95%88%E6%9E%9C%E6%9C%89%E4%BB%80%E4%B9%88%E4%B8%8D%E5%90%8C%EF%BC%9F"><span class="toc-number">31.</span> <span class="toc-text">rgba()和 opacity 的透明效果有什么不同？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Sass%E3%80%81LESS-%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F%E5%A4%A7%E5%AE%B6%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E4%BD%BF%E7%94%A8%E4%BB%96%E4%BB%AC%EF%BC%9F"><span class="toc-number">32.</span> <span class="toc-text">Sass、LESS 是什么？大家为什么要使用他们？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%A1%8C%E5%86%85%E5%85%83%E7%B4%A0%E6%9C%89%E5%93%AA%E4%BA%9B%EF%BC%9F%E5%9D%97%E7%BA%A7%E5%85%83%E7%B4%A0%E6%9C%89%E5%93%AA%E4%BA%9B%EF%BC%9F%E7%A9%BA-void-%E5%85%83%E7%B4%A0%E6%9C%89%E9%82%A3%E4%BA%9B%EF%BC%9F%E6%A0%B7%E5%BC%8F%E4%B9%8B%E9%97%B4%E7%9A%84%E8%BD%AC%E6%8D%A2"><span class="toc-number">33.</span> <span class="toc-text">行内元素有哪些？块级元素有哪些？空(void)元素有那些？样式之间的转换</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#CSS3-%E6%96%B0%E7%89%B9%E6%80%A7%E6%9C%89%E5%93%AA%E4%BA%9B%EF%BC%9F"><span class="toc-number">34.</span> <span class="toc-text">CSS3 新特性有哪些？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#CSS3-%E9%80%89%E6%8B%A9%E5%99%A8%E6%9C%89%E5%93%AA%E4%BA%9B%EF%BC%9F"><span class="toc-number">35.</span> <span class="toc-text">CSS3 选择器有哪些？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%A7%BB%E5%8A%A8%E7%AB%AF%E4%BC%98%E5%85%88%E4%BD%BF%E7%94%A8%E5%BC%B9%E6%80%A7%E5%B8%83%E5%B1%80%EF%BC%88flex%EF%BC%89%E6%9D%A5%E8%A7%A3%E5%86%B3%E5%B8%83%E5%B1%80%E9%97%AE%E9%A2%98%EF%BC%8C%E8%AF%B7%E5%88%97%E5%87%BA%E5%BC%B9%E6%80%A7%E5%B8%83%E5%B1%80%E7%9A%84%E7%9B%B8%E5%85%B3%E5%B1%9E%E6%80%A7%EF%BC%8C%E5%B9%B6%E8%AF%B4%E6%98%8E%E5%B1%9E%E6%80%A7%E7%94%A8%E9%80%94"><span class="toc-number">36.</span> <span class="toc-text">移动端优先使用弹性布局（flex）来解决布局问题，请列出弹性布局的相关属性，并说明属性用途</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#CSS3-%E7%9A%84%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98%E6%80%8E%E4%B9%88%E5%A4%84%E7%90%86%EF%BC%9F"><span class="toc-number">37.</span> <span class="toc-text">CSS3 的兼容问题怎么处理？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#CSS3-%E5%8A%A8%E7%94%BB%E5%92%8C-JS-%E5%8A%A8%E7%94%BB%E4%B8%BB%E8%A6%81%E7%9A%84%E4%B8%8D%E5%90%8C%E7%82%B9%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="toc-number">38.</span> <span class="toc-text">CSS3 动画和 JS 动画主要的不同点是什么？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AF%B7%E7%94%A8-Css-%E5%86%99%E4%B8%80%E4%B8%AA%E7%AE%80%E5%8D%95%E7%9A%84%E5%B9%BB%E7%81%AF%E7%89%87%E6%95%88%E6%9E%9C%E9%A1%B5%E9%9D%A2"><span class="toc-number">39.</span> <span class="toc-text">请用 Css 写一个简单的幻灯片效果页面</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Rem-%E7%9A%84%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95"><span class="toc-number">40.</span> <span class="toc-text">Rem 的使用方法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%94%A8-css-%E7%94%BB%E4%B8%80%E4%B8%AA%E4%B8%89%E8%A7%92%E5%BD%A2%EF%BC%8C%E5%9C%86%EF%BC%8C%E6%A4%AD%E5%9C%86%EF%BC%9F"><span class="toc-number">41.</span> <span class="toc-text">用 css 画一个三角形，圆，椭圆？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#html5-%E6%9C%89%E5%93%AA%E4%BA%9B%E6%96%B0%E7%89%B9%E6%80%A7%E3%80%81%E7%A7%BB%E9%99%A4%E4%BA%86%E9%82%A3%E4%BA%9B%E5%85%83%E7%B4%A0%EF%BC%9F%E5%A6%82%E4%BD%95%E5%A4%84%E7%90%86-HTML5-%E6%96%B0%E6%A0%87%E7%AD%BE%E7%9A%84%E6%B5%8F%E8%A7%88%E5%99%A8%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98%EF%BC%9F"><span class="toc-number">42.</span> <span class="toc-text">html5 有哪些新特性、移除了那些元素？如何处理 HTML5 新标签的浏览器兼容问题？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#HTML5-%E4%B8%AD%E6%96%B0%E5%A2%9E%E7%9A%84%E6%93%8D%E4%BD%9C-DOM-%E7%9A%84%E6%96%B9%E6%B3%95%EF%BC%9F"><span class="toc-number">43.</span> <span class="toc-text">HTML5 中新增的操作 DOM 的方法？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#image-%E5%92%8C-canvas-%E5%9C%A8%E5%A4%84%E7%90%86%E5%9B%BE%E7%89%87%E7%9A%84%E6%97%B6%E5%80%99%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB%EF%BC%9F"><span class="toc-number">44.</span> <span class="toc-text">image 和 canvas 在处理图片的时候有什么区别？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#HTML5-%E4%B8%AD%E7%9A%84%E6%9C%AC%E5%9C%B0%E5%AD%98%E5%82%A8%E6%A6%82%E5%BF%B5%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E6%9C%89%E5%A4%9A%E9%95%BF%EF%BC%9F"><span class="toc-number">45.</span> <span class="toc-text">HTML5 中的本地存储概念是什么？生命周期有多长？</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/blog/2023/03/18/React%E6%A8%A1%E6%8B%9F%E7%A7%BB%E5%85%A5title%E6%8F%90%E7%A4%BA/" title="React模拟移入title提示"><img src="/blog/2023/03/18/React%E6%A8%A1%E6%8B%9F%E7%A7%BB%E5%85%A5title%E6%8F%90%E7%A4%BA/react-logo.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="React模拟移入title提示"/></a><div class="content"><a class="title" href="/blog/2023/03/18/React%E6%A8%A1%E6%8B%9F%E7%A7%BB%E5%85%A5title%E6%8F%90%E7%A4%BA/" title="React模拟移入title提示">React模拟移入title提示</a><time datetime="2023-03-18T14:58:49.000Z" title="发表于 2023-03-18 22:58:49">2023-03-18</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2023/03/08/React%E9%AB%98%E9%98%B6%E7%BB%84%E4%BB%B6%E6%9C%89%E5%93%AA%E4%BA%9B%E4%BC%98%E7%82%B9%E5%92%8C%E7%BC%BA%E7%82%B9/" title="React高阶组件有哪些优点和缺点"><img src="/blog/2023/03/08/React%E9%AB%98%E9%98%B6%E7%BB%84%E4%BB%B6%E6%9C%89%E5%93%AA%E4%BA%9B%E4%BC%98%E7%82%B9%E5%92%8C%E7%BC%BA%E7%82%B9/react-logo.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="React高阶组件有哪些优点和缺点"/></a><div class="content"><a class="title" href="/blog/2023/03/08/React%E9%AB%98%E9%98%B6%E7%BB%84%E4%BB%B6%E6%9C%89%E5%93%AA%E4%BA%9B%E4%BC%98%E7%82%B9%E5%92%8C%E7%BC%BA%E7%82%B9/" title="React高阶组件有哪些优点和缺点">React高阶组件有哪些优点和缺点</a><time datetime="2023-03-08T14:58:49.000Z" title="发表于 2023-03-08 22:58:49">2023-03-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2022/08/02/useContext%E6%A8%A1%E6%8B%9Fredux/" title="useContext模拟redux"><img src="/blog/2022/08/02/useContext%E6%A8%A1%E6%8B%9Fredux/react-logo.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="useContext模拟redux"/></a><div class="content"><a class="title" href="/blog/2022/08/02/useContext%E6%A8%A1%E6%8B%9Fredux/" title="useContext模拟redux">useContext模拟redux</a><time datetime="2022-08-02T14:58:49.000Z" title="发表于 2022-08-02 22:58:49">2022-08-02</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2022/07/13/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%9D%A2%E8%AF%95%E9%A2%98/" title="小程序面试题"><img src="/blog/2022/07/13/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%9D%A2%E8%AF%95%E9%A2%98/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%9B%BE%E6%A0%87.jpeg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="小程序面试题"/></a><div class="content"><a class="title" href="/blog/2022/07/13/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%9D%A2%E8%AF%95%E9%A2%98/" title="小程序面试题">小程序面试题</a><time datetime="2022-07-13T15:39:09.000Z" title="发表于 2022-07-13 23:39:09">2022-07-13</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/" title="HTML和CSS面试题"><img src="/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/csslogo.png" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="HTML和CSS面试题"/></a><div class="content"><a class="title" href="/blog/2022/07/10/HTML%E5%92%8CCSS%E9%9D%A2%E8%AF%95%E9%A2%98/" title="HTML和CSS面试题">HTML和CSS面试题</a><time datetime="2022-07-10T14:22:28.000Z" title="发表于 2022-07-10 22:22:28">2022-07-10</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2024 By 破破</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/blog/js/utils.js?v=4.14.0-b3"></script><script src="/blog/js/main.js?v=4.14.0-b3"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0.35/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"><script>(() => {
  const runMermaid = (ele) => {
    window.loadMermaid = true
    const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'default'

    Array.from(ele).forEach((item, index) => {
      const mermaidSrc = item.firstElementChild
      const mermaidThemeConfig = '%%{init:{ \'theme\':\'' + theme + '\'}}%%\n'
      const mermaidID = 'mermaid-' + index
      const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContent

      const renderFn = mermaid.render(mermaidID, mermaidDefinition)

      const renderV10 = () => {
        renderFn.then(({svg}) => {
          mermaidSrc.insertAdjacentHTML('afterend', svg)
        })
      }

      const renderV9 = svg => {
        mermaidSrc.insertAdjacentHTML('afterend', svg)
      }

      typeof renderFn === 'string' ? renderV9(renderFn) : renderV10()
    })
  }

  const codeToMermaid = () => {
    const codeMermaidEle = document.querySelectorAll('pre > code.mermaid')
    if (codeMermaidEle.length === 0) return
    
    codeMermaidEle.forEach(ele => {
      const newEle = document.createElement('div')
      newEle.className = 'mermaid-wrap'
      newEle.innerHTML = `<pre class="mermaid-src" hidden>${ele.textContent}</pre>`
      ele.parentNode.replaceWith(newEle)
    })
  }

  const loadMermaid = () => {
    if (false) codeToMermaid()
    const $mermaid = document.querySelectorAll('#article-container .mermaid-wrap')
    if ($mermaid.length === 0) return

    const runMermaidFn = () => runMermaid($mermaid)
    btf.addGlobalFn('themeChange', runMermaidFn, 'mermaid')
    window.loadMermaid ? runMermaidFn() : btf.getScript('https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js').then(runMermaidFn)
  }
  
  btf.addGlobalFn('encrypt', loadMermaid, 'mermaid')
  window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
})()</script></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>